<?php

/**
 * monitoreo filter form.
 *
 * @package    plagas
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class monitoreoFormFilter extends BasemonitoreoFormFilter
{
  public function configure()
  {
      unset($this['realizado'],
            $this['programado'],
            $this['obs'],
            $this['estadofenologico_id'],
            $this['resultado']
           );

        $this->widgetSchema['establecimiento_id'] = new sfWidgetFormDoctrineChoice(array(
            'model'     => 'establecimiento',
            'add_empty' => false,
            'table_method' => 'getEstablecimientos'));

        $this->widgetSchema['lote_id'] = new sfWidgetFormDoctrineDependentSelect(array(
            'model'     => 'lote',
            'depends'   => 'establecimiento_id',
            'add_empty' => false,
            'ref_method'   => 'getEstablecimientoId',));

        $this->widgetSchema['campana_id'] = new sfWidgetFormDoctrineDependentSelect(array(
            'model'     => 'campana',
            'depends'   => 'lote_id',
            'add_empty' => 'Todas',
            'ref_method'   => 'getLoteId',));

        $this->widgetSchema->moveField('campana_id', 'after', 'lote_id');


        $this->validatorSchema['establecimiento_id'] = new sfValidatorDoctrineChoice(array(
            'model' => 'establecimiento',
        ));

        $this->validatorSchema['lote_id'] = new sfValidatorDoctrineChoice(array(
            'model' => 'lote',
        ));

        $this->validatorSchema['campana_id'] = new sfValidatorDoctrineChoice(array(
            'model' => 'campana',
        ));
  }
}
